import { Component } from "react";
import PubSub from "pubsub-js";
class User extends Component {
  sendMsg = () => {
    PubSub.publish("USERMSG", "hello 我是user发布的消息");
  };
  render() {
    return (
      <div>
        <button onClick={this.sendMsg}>发布消息</button>
      </div>
    );
  }
}
export default User;
